//
//  ITUserInfo.m
//  GLPFinance
//
//  Created by ITBE on 2016/11/23.
//  Copyright © 2016年 intube. All rights reserved.
//

#import "ITUserInfo.h"
//#import "TTBindAccount.h"

@implementation ITMember

+ (NSDictionary *)modelCustomPropertyMapper {
    return @{
             @"memberId": @[@"id", @"memberId"],
             @"isNewer": @"newer",
             @"liked": @"statistics.liked",
             @"follow": @"statistics.follow",
             @"fans": @"statistics.fans",
             @"approved": @"interactionSummary.approved",
             @"processing": @"interactionSummary.processing",
             @"failed": @"interactionSummary.failed",
             @"joined": @"interactionSummary.joined",
             };
}

+ (NSDictionary *)modelContainerPropertyGenericClass {
    // value使用[YYEatModel class]或YYEatModel.class或@"YYEatModel"没有区别
    return @{};
}


// 如果实现了该方法，则处理过程中会忽略该列表内的所有属性
+ (NSArray *)modelPropertyBlacklist {
    return @[@"account"];
}

-(instancetype)initWithDictionary:(NSDictionary *)dic{
    self = [super init];
    if (self) {
        [self modelSetWithDictionary:dic];
    }
    return self;
}

/**
 将用户对象转义成字典
 
 @return 用户信息字典
 */
-(NSDictionary *)dictionaryInfo
{
    NSMutableDictionary *dic = [self modelToJSONObject];
    return dic;
}

-(NSString *)sexDescription
{
    return [self sexDescription:_gender];
}

-(NSString *)sexDescription:(SexType)gender
{
    if (gender == SexMale) {
        return @"Male";
    }else if (gender == SexFemale){
        return @"Female";
    }else if (gender == SexSecret){
        return @"Secret";
    }
    return @"";
}



//关注状态  0:未关注 1已关注 2互关 3被关注
- (BOOL)isFollowed{
    return _followType == 1 || _followType == 2;
}

- (void)setIsFollowed:(BOOL)isFollowed{
    if (isFollowed) {
        if (_followType == 3) {
            _followType = 2;
        }else {
            _followType = 1;
        }
        
        _fans ++;
    }else{
        if (_followType == 2) {
            _followType = 3;
        }else {
            _followType = 0;
        }
        if (_fans>0) {
            _fans--;
        }
    }
}
@end
